/* Messages 模块样式 */
.messages-container {
    display: flex;
    height: calc(100vh - 50px);
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* 消息页面头部样式调整 */
#messages .page-header {
    padding: 8px 15px;
    margin-bottom: 3px;
    height: auto;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#messages .page-header h1 {
    font-size: 22px;
    margin: 0;
    font-weight: 600;
}

/* 消息侧边栏样式 */
.messages-sidebar {
    width: 280px;
    border-right: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    background-color: #f9f9f9;
}

.message-search {
    padding: 15px;
    border-bottom: 1px solid #eaeaea;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.search-input {
    flex: 1;
    position: relative;
    margin-right: 10px;
}

.search-input i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #777;
}

.search-input input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border: 1px solid #eaeaea;
    border-radius: 20px;
    background-color: #fff;
    transition: all 0.3s;
}

.search-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.message-tabs {
    display: flex;
    border-bottom: 1px solid #eaeaea;
    position: relative;
}

.message-tabs .tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    color: #888;
    transition: all 0.3s;
    position: relative;
}

.message-tabs .tab.active {
    color: var(--primary-color);
}

.message-tabs .tab.active:after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

.new-msg-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.new-msg-btn:hover {
    background-color: var(--primary-color-dark, #0069d9);
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.contact-item:hover {
    background-color: #f0f0f0;
}

.contact-item.active {
    background-color: rgba(0, 123, 255, 0.1);
}

.contact-item .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.contact-info {
    flex: 1;
    overflow: hidden;
}

.contact-info h4 {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.contact-info p {
    margin: 0;
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 10px;
}

.contact-time {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.unread-badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 500;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* 消息主内容区域样式 */
.messages-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    position: relative;
}

.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    text-align: center;
    padding: 20px;
}

.empty-chat-icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 15px;
}

.empty-chat h3 {
    margin: 0 0 10px;
    font-weight: 500;
}

.empty-chat p {
    margin: 0 0 20px;
    max-width: 300px;
    line-height: 1.5;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid #eaeaea;
    background-color: #fff;
    height: 45px;
}

.chat-contact-info {
    display: flex;
    align-items: center;
}

.chat-contact-info .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.contact-details h3 {
    margin: 0 0 2px;
    font-size: 17px;
    font-weight: 600;
}

.status {
    font-size: 13px;
    display: flex;
    align-items: center;
}

.status:before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.status.online:before {
    background-color: #2ecc71;
}

.status.offline:before {
    background-color: #95a5a6;
}

.status.busy:before {
    background-color: #e74c3c;
}

.chat-actions {
    display: flex;
    align-items: center;
}

.chat-actions .btn-icon {
    margin-left: 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    background-color: #f9f9f9;
}

.message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6px;
    position: relative;
}

.message.received {
    padding-right: 60px;
}

.message.sent {
    flex-direction: row-reverse;
    padding-left: 60px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px;
    margin-top: 4px;
}

.message.sent .message-avatar {
    margin-right: 0;
    margin-left: 10px;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    max-width: 75%;
    position: relative;
}

.message.sent .message-content {
    background-color: #4CAF50;
    color: #000000;
    border-radius: 15px 15px 2px 15px;
}

.message.received .message-content {
    background-color: white;
    border-radius: 15px 15px 15px 2px;
    border: 1px solid #eaeaea;
}

.message-sender {
    font-weight: 500;
    font-size: 12px;
    color: #777;
    margin-bottom: 2px;
}

.message-text {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.message-time {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
    text-align: right;
}

.message.sent .message-time {
    color: rgba(0, 0, 0, 0.6);
}

.message-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0 10px;
    position: relative;
    text-align: center;
}

.message-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.message-date-separator span {
    background-color: #f7f7f7;
    padding: 0 10px;
    font-size: 12px;
    color: #888;
    position: relative;
    z-index: 2;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.message-actions {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.message.sent .message-actions {
    left: -40px;
    right: auto;
}

.message:hover .message-actions {
    display: flex;
}

.message-action {
    width: 30px;
    height: 30px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    cursor: pointer;
    margin-top: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.message-action:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Styling for optimistic messages (sending) */
.message.optimistic .message-content {
    opacity: 0.8;
}

/* 消息发送状态指示器 */
.sending-indicator {
    color: #555;
    margin-left: 5px;
    animation: pulse 1.5s infinite;
}

.sent-indicator {
    color: #555;
    margin-left: 5px;
}

.message.sent .sent-indicator {
    color: rgba(0, 0, 0, 0.7);
}

.message.received .sent-indicator {
    color: rgba(0, 0, 0, 0.6);
}

.read-indicator {
    color: #4CAF50;
    margin-left: 5px;
}

.error-indicator {
    color: #e74c3c;
    margin-left: 5px;
    animation: pulse 1s infinite;
}

/* 发送失败的消息样式 */
.message.failed .message-content {
    border: 1px solid rgba(231, 76, 60, 0.5);
    opacity: 0.8;
}

.message.sending .message-content {
    opacity: 0.8;
}

.retry-btn {
    background-color: rgba(231, 76, 60, 0.1) !important;
    color: #e74c3c !important;
}

.retry-btn:hover {
    background-color: rgba(231, 76, 60, 0.2) !important;
}

/* 消息撤回样式 */
.message-recalled {
    font-style: italic;
    color: #666;
    font-size: 0.9em;
    text-align: center;
}

.message.sent .message-recalled {
    color: #333;
}

/* Animations */
@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Reply styling */
.message-reply-to {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 2px solid rgba(0, 0, 0, 0.3);
    font-size: 12px;
    color: #333;
}

.message.sent .message-reply-to {
    background-color: rgba(0, 0, 0, 0.15);
    border-left-color: rgba(0, 0, 0, 0.3);
    color: #000;
}

.chat-input-area {
    padding: 8px 10px;
    border-top: 1px solid #eaeaea;
    background-color: #fff;
}

.chat-tools {
    margin-bottom: 4px;
    height: 28px;
    display: flex;
    align-items: center;
}

.chat-tools .btn-icon {
    margin-right: 10px;
    color: #888;
    width: 24px;
    height: 24px;
}

.chat-input {
    display: flex;
    align-items: flex-end;
}

.chat-input textarea {
    width: 100%;
    min-height: 40px;
    max-height: 120px;
    padding: 8px 40px 8px 10px;
    border: 1px solid #eaeaea;
    border-radius: 20px;
    resize: vertical;
    font-size: 15px;
    line-height: 1.4;
    background-color: #f9f9f9;
}

.btn-send {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-send i {
    font-size: 15px;
}

.btn-send:hover {
    background-color: var(--primary-dark);
    transform: scale(1.05);
}

/* 新建消息弹窗样式 */
.modal-contacts-list {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.contacts-section h4 {
    margin: 15px 0 10px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.modal-contact-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-contact-item:hover {
    background-color: #f0f0f0;
}

.modal-contact-item img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.modal-contact-item h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

/* 聊天信息统计 */
.chat-header-info {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.message-count {
    font-size: 12px;
    color: #666;
    margin-right: 10px;
}

.btn-browse-history {
    font-size: 12px;
    color: var(--primary-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-browse-history:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

/* 消息浏览器样式 */
.message-browser-container {
    padding: 15px;
}

.message-browser-date {
    margin: 20px 0;
}

.message-browser-messages {
    margin-bottom: 20px;
}

.message-browser-item {
    display: flex;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    background-color: #f9f9f9;
    transition: all 0.2s;
}

.message-browser-item:hover {
    background-color: #f0f0f0;
}

.message-browser-item.sent {
    background-color: rgba(76, 175, 80, 0.1);
}

.message-browser-item.received {
    background-color: rgba(0, 0, 0, 0.05);
}

.message-browser-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
}

.message-browser-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-browser-content {
    flex: 1;
}

.message-browser-sender {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.message-browser-time {
    font-size: 12px;
    color: #999;
    font-weight: normal;
}

.message-browser-text {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.message-browser-stats {
    display: flex;
    flex: 1;
}

.message-browser-stats span {
    margin-right: 15px;
    font-size: 14px;
    color: #666;
}

/* 通知标记 */
.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background-color: #e74c3c;
    border-radius: 50%;
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* 加载动画 */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #888;
}

.loading-spinner i {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .messages-container {
        flex-direction: column;
    }
    
    .messages-sidebar {
        width: 100%;
        height: 100%;
        position: absolute;
        z-index: 10;
        transition: transform 0.3s ease;
    }
    
    .messages-sidebar.hidden {
        transform: translateX(-100%);
    }
    
    .back-to-contacts {
        display: block;
    }
}

/* 新消息高亮效果 */
.contact-item.new-message {
    animation: highlightNewMessage 2s ease;
    background-color: rgba(76, 175, 80, 0.1);
}

@keyframes highlightNewMessage {
    0% { background-color: rgba(76, 175, 80, 0.3); }
    100% { background-color: rgba(76, 175, 80, 0.1); }
}

.message.sent .message-text {
    color: #000000;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.message.received .message-text {
    color: #333333;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
} 